package ch13;

import org.omg.CORBA.PUBLIC_MEMBER;

public class ThreadExit extends Thread{

	
	private boolean running = true;

	@Override
	public void run() {
	
		while(running) {
			System.out.println("下载中...");
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
			}
		}
		System.out.println("子线程运行完毕");
	}
	public void stopDownload() {
		running = false;
	}

	public static void main(String[] args) {
	
		ThreadExit threadExit = new ThreadExit();
		threadExit.start();
		try {
			ThreadExit.sleep(5000);
		} catch (InterruptedException e) {
			
		}
		threadExit.stopDownload();
		System.out.println("主线程运行完毕");
	}


}

